/*---------------------------------------------------------------------------
	ZaRan	-	A Totallly Automatic CFD Software
	Copyright (C) ,Since 2020
-------------------------------------------------------------------------------
License
	This file is part of ZaRan.

!	@file	multigird.h
!	@brief	the purpose of this file.
!	@author	Chen Jie.
\*---------------------------------------------------------------------------*/
#pragma once
#include"grid.h"

class MultiGrid
{
public:
	MultiGrid() {};
public:
	void SetGridNum(int grid_num) { gridVec_.resize(grid_num); }
	void SetGridDim(int dim);
	void SetGridDim(size_t iGrid, int dim);
	void SetGridIndex(size_t iGrid, size_t index);
	void SetGridList(vector<Grid>& grid_list);
	void SetInterNode();
public:

	int GetGridNum() { return gridVec_.size(); }
	int GetNodeNum(size_t iGrid)const { return gridVec_[iGrid].GetNodeNum(); }
	int GetNeiborNodeNum(size_t iGrid, size_t iNode) { return gridVec_[iGrid].GetNeiborNodeNum(iNode); }
	int GetBoundNodeNum(size_t iGrid)const { return gridVec_[iGrid].GetBoundNodeNum(); }
	int GetElementNum(size_t iGrid)const { return gridVec_[iGrid].GetElementNum(); }
	Dimension GetDim() { return gridVec_[0].GetDim(); }
	Grid* GetGrid(size_t iGrid) { return &gridVec_[iGrid]; }
	vector<Grid>* GetGridVec() { return &gridVec_; }
	GridNode* GetGridNode(size_t iGrid, size_t iNode) { return gridVec_[iGrid].GetNode(iNode); }
	Point* GetNodeCoord(size_t iGrid, size_t iNode) { return gridVec_[iGrid].GetNodeCoord(iNode); }
	BoundType* GetNodeType(size_t iGrid, int iNode) { return gridVec_[iGrid].GetNodeType(iNode); }
	size_t GetBoundNodeIndex(size_t iGrid, size_t iNode) { return gridVec_[iGrid].GetBoundNodeIndex(iNode); }
	vector<size_t>* GetElementNodeIndex(size_t iGrid, size_t iElem) { return gridVec_[iGrid].GetElementNodeIndex(iElem); }
	vector<CoordTrans>* GetNodeCoordTrans(size_t iGrid, size_t iNode) { return gridVec_[iGrid].GetNodeCoordTrans(iNode); }
	vector< GridNode*>* GetNeiborNodePtrVec(size_t iGrid, size_t iNode) { return gridVec_[iGrid].GetNeiborNodePtrVec(iNode); }
public:
	void ReorderNeiborNode();
	void CalCoordTrans();
public:
	void OutGrid(std::ostream& fout);
private:
	// list of grids
	vector<Grid> gridVec_;
};
